package cn.lsh.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.lsh.cas.ShiroCasConfiguration;
import cn.lsh.pojo.User;

@Controller
public class CasLoginController {

	@RequestMapping(value="/login",method=RequestMethod.GET)
	public String loginFrom(Model model){
		model.addAttribute("user", new User());
		return "redirect:"+ShiroCasConfiguration.loginUrl;
	}
	
	@RequestMapping(value="/logout")
	public String loginOut(HttpSession session){
		return "redirect:"+ShiroCasConfiguration.logoutUrl;
	}
	
	@RequestMapping(value="/home")
	public String index(HttpSession session,ModelMap map,HttpServletRequest request){
		return "index";
	}
}
